package com.we.wecc.bg.api.controller;

import com.we.wecc.bg.mid.service.BackService;
import com.x.share.api.controller.BaseController;
import com.x.share.mid.exception.HelperException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@Api("管理后台接口")
@RestController
@RequestMapping("/back/")
public class BackController extends BaseController
{

    @Resource
    BackService backService;

    @ApiOperation(value = "统一调整小说漫画收益率", notes= "在原收益率上乘以传入的数值", response = Boolean.class)
    @RequestMapping(value = "/reviseProfit", method = { RequestMethod.GET})
    public @ResponseBody Map<String, Object> reviseProfit(
            @ApiParam(value = "收益率要乘的数字") @RequestParam("profitNum") double profitNum,
            @ApiParam(value = "类型(0小说 1漫画)") @RequestParam("type") Integer type,
            @ApiParam(value = "应用id",defaultValue = "10001") @RequestHeader("appId") String appId,
            @ApiParam(value = "应用accessToken") @RequestHeader("atk") String atk) throws HelperException {
        Boolean flag = backService.reviseProfit(profitNum, type);
        return success(flag);
    }
}
